package com.bytech.common.biz.entity.blogUser;

import java.util.Date;

import com.bytech.common.config.AppGlobalConstants;

import org.springframework.beans.BeanUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @Author zhao
 * @Create 2021/7/2815:10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
public class BlogUserAgent {

    private String id;
    private String name;
    private String nickName;
    private String account;
    private String email;
    private String avatarUrl;
    private Boolean isOnline;
    private String status;
    private String token;
    private String description;
    private Date lastLoginTime;
    private String lastLoginIp;
    private Date createTime;
    private Date modifyTime;

    public BlogUserAgent(BlogUser user) {
        if (user != null) {
            BeanUtils.copyProperties(user, this);
        }
    }

    @JsonIgnore
    public boolean isAdminUser() {
        return AppGlobalConstants.BLOG_ADMIN_USER_ID.equalsIgnoreCase(this.id);
    }
}
